﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'U' AND name = 'Measurement')
	BEGIN
		DROP  Table Measurement
	END
GO

CREATE TABLE Measurement
(
   MeasurementId int identity(1,1) not null,
   MeasurementTypeId int not null,
   BodyId int not null,
   Value float not null
   
   constraint pkMeasurement primary key (MeasurementId),
   constraint uqMeasurementTypeIdBodyId unique (MeasurementTypeId, BodyId),
   constraint fkMeasurementToBody foreign key (BodyId) references Body (BodyId),
   constraint fkMeasurementToMeasurementType foreign key (MeasurementTypeId) references MeasurementType (MeasurementTypeId)
)
GO   